The present invention relates to rendering glyphs.
A character is an abstract construct that often, although not always, represents an atomic unit in some system of expression, such as a language. Each character can be represented by a set of character attributes that define the semantic information of the character. A character encoding associates the set of character attributes for a character with a particular encoding value—for example, a scalar value included in a character set standard, such as ASCII (American Standard Code for Information Interchanges) or Unicode.
A glyph is a visual representation of a character, such as a graphical token or symbol. A glyph image is a particular image of a glyph that has been rasterized or otherwise imaged onto some display surface. A font is a collection of glyphs, and can include one or more corresponding mapping of glyphs to characters (i.e., to encoding values). A font is typically constructed to support a character set standard. That is, fonts include glyphs representing characters included in the character set standard. A glyph can be associated with a set of glyph attributes defining appearance information for a representation of the corresponding character, and generally provide the information necessary to render the glyph. A glyph can include, or can be associated with, a set of instructions for rendering the glyph. For example, TrueType™ fonts, available from Microsoft Corporation of Redmond, Wash., include glyphs that are associated with a set of instructions for use when rendering the glyph. A TrueType font program can include a component used for font-wide calculations and a per-glyph component for rendering a specific glyph within the font.
Hinting is a method of defining which pixels are turned on in order to create the best possible glyph bitmap shape, particularly at small sizes and low resolutions. A glyph's outline determines which pixels will constitute the bitmap. It is often necessary to modify the outline to create the bitmap, i.e., modify the outline until the desired combination of pixels is turned on. The modified outline can be referred to as a hinted outline. In certain fonts, such as TrueType fonts, a hint is a mathematical instruction that is included in the font program that defines a distortion of a glyph's outline at particular sizes.
Certain types of visual output devices for computer systems are capable of outputting in “gray scale”. That is, each of the pixels in the raster matrix of the output device is capable of displaying a number of tones, typically from pure light to pure dark. Anti-aliasing is a technique of varying the gray scale or color values of the pixels representing a glyph image to provide the appearance of smoother curves and less jagged diagonal lines.
FIGS. 1 to 3 illustrate one example of an anti-aliasing procedure. FIG. 1 shows an outline 105 and a hinted outline 110 representative of a glyph image representing the Latin-based character “a”. The outline 105 is produced at 4 times the desired size for rendering the glyph. For example, if the desired size is 25 ppem (pixels per em), then the outline is produced for the corresponding glyph at 100 ppem. The glyph image is shown on top of a fine grid 115 and a coarse grid 120, where the ratio of the fine grid resolution to the coarse grid resolution is 4 to 1 in both directions.
The outline 105 of the glyph image can be hinted (i.e., adjusted) relative to the fine grid 115 or the coarse grid 120 to provide the best outline for particular rendering conditions. In the example shown, the outline 105 is hinted relative to the fine grid to produce the hinted outline 110. The hinted outline is then scan converted, that is, converted from an outline to a pixellated representation, at the fine grid resolution to produce a monochrome bitmap 205, shown in FIG. 2, corresponding to a 100 ppem glyph.
Referring to FIG. 3, in this example, the bitmap is downsampled to render a gray scale representation 305 of the glyph. Because the desired size is 4 times less than the size used to produce the hinted outline 110 and resulting monochrome bitmap 205, the downsampling process treats the 100 ppem monochrome bitmap 205 as a 25 ppem high resolution bitmap, where the ratio of the high resolution to the device resolution is 4 to 1 in both directions. That is, the grid 201 shown in FIG. 2 corresponds to the device resolution, which refers to the maximum number of individual pixels that can be displayed on a computer output device used to display the glyph image. The resulting gray scale representation 305 shown in FIG. 3 represents the glyph rendered at the desired 25 ppem size, and is anti-aliased in both directions, evident by the varying tones of gray used for each pixel. The gray tone was determined based on an interpretation of the “high resolution” bitmap 205.
The anti-aliasing procedure described above is isotropic, in the sense that the “degree” of anti-aliasing is the same in both the x and y directions. One existing approach to anisotropic rendering is to anti-alias to some degree in the x direction without anti-aliasing to any degree in the y direction, to generate a high resolution bitmap representation of a glyph. The ratio of the high resolution to the device resolution is 6 to 1 in the x direction and 1 to 1 in the y direction.